package cn.appsys.controller;

import cn.appsys.pojo.BackendUser;
import cn.appsys.service.BackendUserService;
import cn.appsys.tools.Constants;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;
import javax.servlet.http.HttpSession;

@Controller
public class BackendUserController {
    @Resource
    BackendUserService backendUserService;
    //后台登录
    @RequestMapping("backlogin.do")
    public String login(String userName, String userPassword, HttpSession session) {
        BackendUser backendUser = backendUserService.login(userName, userPassword);
        session.setAttribute(Constants.USER_SESSION, backendUser);
        return backendUser != null ? "redirect:list" : "backendlogin.jsp";
    }
}
